import processing.core.PConstants;

//Box is the object made for each entry in HeatView
//	It represents an hour of a day

public class Box {
	int x, y;
	int size;
	int color;
	int value;
	String date = "";
	float dateX, dateY;
	
	public Box(int _x, int _y, int _s, int _c, int _v, String _d, float dx, float dy) {
		x = _x;
		y = _y;
		size = _s;
		color = _c;
		value = _v;
		date = _d;
		dateX = dx;
		dateY = dy;
		
		//boxes of value 0 are smaller
		if(value == 0) {
			size -=2;
			x++;
			y++;
		}
	}
	
	public boolean mouseOver() {
        if(GLOBAL.processing.mouseX > x && GLOBAL.processing.mouseX < x+size && 
                        GLOBAL.processing.mouseY > y && GLOBAL.processing.mouseY < y+size) return true;
        return false;
    }
	
	public void draw() {
		if(mouseOver()) {
			GLOBAL.processing.fill(255);
			GLOBAL.processing.textSize(14);
			GLOBAL.processing.textAlign(PConstants.CENTER);
			GLOBAL.processing.text(date, dateX, dateY);
			GLOBAL.processing.text("Play Count: " + value, dateX, dateY+22);
			GLOBAL.processing.textAlign(PConstants.LEFT);
			GLOBAL.processing.fill(GLOBAL.colorTabMouseOver);
		}
			
		else
			GLOBAL.processing.fill(color);
		
		
		GLOBAL.processing.noStroke();
		GLOBAL.processing.rect(x, y, size, size);
	}
}
